<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>JS - Date对象测试</title>
		<script>
			function getCurrentTime() {
				var date = new Date();
				var current = date.getFullYear() + "-" + (date.getMonth() + 1)
				 + "-" + date.getDate() + " " + date.getHours() + ":" +
				 date.getMinutes() + ":" + date.getSeconds();
				var text = document.getElementById("d1");
				text.value = current;
			}
		</script>
	</head>
	<body>
		<h2>获取当前系统时间</h2>
		当前时间：<input id="d1" type="text" readonly />
		<input type="button" value="获取时间" onclick="getCurrentTime()" />
	</body>
</html>
